{% extends 'base.html' %}

{% block title_suffix %}
    | Edit Text Artefact
{% endblock %}

{% block stylesheets %}
{% endblock %}

{% block all_content %}
	<div class="page-header">
		<h1>
			Edit <i>{{ text.name }}</i> <small>Text artefact editing</small>
		</h1>
	</div>

	<form id="save-form" method="post">
		{% csrf_token %}

		<textarea name="editor">{{ text.html }}</textarea>
		<br />

		<div id="saving" class="progress progress-striped active" style="display: none;" >
				<div class="bar" style="width: 100%;">Saving</div>
		</div>
		<div id="save-success" class="alert alert-success" style="display: none;">
			<strong>Changes Saved!</strong> The changes were successfully saved.
		</div>
    
		<div id="save-error" class="alert alert-error" style="display: none;">
			<strong>Error!</strong> Something went wrong when trying to save.
		</div>

		<div class="form-actions">
			<div class="pull-right">
				<a id="form-cancel" class="btn" href="{% url 'engonline.views.list_text_artefacts' %}">Cancel</a>
				<a id="form-save" class="btn btn-primary" href="#">Save Changes</a>
			</div>
		</div>
	
	</form>
{% endblock %}

{% block scripts %}
	<script type="text/javascript" src="/static/script/setup_ajax.js"></script>
	<script type="text/javascript" src="/static/lib/ckeditor/ckeditor.js"></script>
	<script type="text/javascript">
		CKEDITOR.config.contentsCss = '/static/lib/bootstrap/css/bootstrap.min.css';
		CKEDITOR.replace('editor');
	</script>
	<script type="text/javascript" src="/static/script/engonline.edit_text_artefact.js"></script>
{% endblock %}